package cn.net.withub.dataCollector.dao;

import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

public interface DaoTool {
	public <T> void save(T t);

	public <T> void saveOrUpdate(T t);

	public <T> void saveLog(T t);

	public <T> void saveOrUpdateLog(T t);

	public <T> void merge(T t);

	public <T> void delete(T t);

	public <T> void deleteLog(T t);

	public <T> void delete(Class<T> entityClass, String id);

	public void deleteObject(Object model);

	public <T> void update(T t);

	public <T, PK extends Serializable> T get(Class<T> entityClass, PK id);

	public <T> List<T> findAll(String hql, Class<T> entityClass);

	public <T> List<T> findAll(String hql, Class<T> entityClass, Object param);

	public <T> List<T> findAll(String hql, Class<T> entityClass, Object[] params);

	public <T> List<T> findByPage(final String hql, final Class<T> entityClass,
								  final int firstResult, final int maxResult);

	public <T> List<T> findByPage(final String hql, final Class<T> entityClass,
								  final Object param, final int firstResult, final int maxResult);

	public <T> List<T> findByPage(final String hql, final Class<T> entityClass,
								  final Object[] params, final int firstResult, final int maxResult);

	public SQLQuery createSQLQuery(String sql);

	public Query createHQLQuery(String hql);

	public <T> List<T> findSQLList(String sql, Class entityClass, int page, int pageSize, Object... params);

	public <T> List<T> findList(String hql, int page, int pageSize, Object... params);

	public <T> List<T> findList(String hql, Object... params);

	public List findSQLList(String sql, Class entityClass, Object... params);

	public List<Map<String,Object>> findSQLList(String sql, Object... params);

	public List<Map<String,Object>> findHQLList(String hql, Object... params);

	public Object getSqlUniqueResult(String sql, Object... params);

	public Object getHqlUniqueResult(String hql, Object... params);

	public Session getCurrentSession();
	public Session getSession();

	public void execute(String sql);

	public void executeUpdate(String sql);
}


